<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>

<link rel="stylesheet" href="http://code.jquery.com/ui/1.9.1/themes/base/jquery-ui.css" />
<script src="http://code.jquery.com/jquery-1.8.2.js"></script>
<%@ include file="template/header.jsp" %>
<script src="http://code.jquery.com/ui/1.9.1/jquery-ui.js"></script>
<script type="text/javascript">
var medicine;

function test(){
	medicine = document.getElementById('autocomplete').value;
	
	if (medicine != ""){
		document.getElementById('labelM').value = medicine;
	}
}
</script>
<script>
$(function() {
		
		$( "#accordion" ).accordion();
		var availableTags = [
			"Chloropheniramine",
			"Denzen",
			"Dexchloropheniramine",
			"Lactose",
			"Leftose",
			"Pacofen",
			"Paracetemol"
		];
		$( "#autocomplete" ).autocomplete({
			source: availableTags
		});
	});
</script>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Create Prescription - GP View</title>
</head>

<%@ page import="database.*, java.util.*" %>
<%
	Medicine m = new Medicine();
	List medi = m.getMedicine();
%>

<body>
	<div id="content_top"></div>
    <div id="content">
    <div id="left">
    	<center><h3>My Info</h3>
    	<img src="template/images.jpg" height="70" width="70" style="border: 1px solid grey; padding: 2px" /></center><br/>
			<li>Edit my profile</li>
			<li><a href="AdministrateCaregiver.jsp">Caregiver</a></li>
			<li><a href="createPrescription.jsp">Prescription Record</a></li>
			&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;- <a href="createPrescription.jsp">Create Prescription</a><br/>
			&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;- <a href="retrievePrescription.jsp">Retrieve Prescription</a><br/>
			&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;- Update Prescription</a><br/>
			&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;- Delete Prescription</a><br/>
			<li><a href="consultation.jsp">Consultant Record</a></li>
	</div>
		
		<div id="right" style="margin: -280px 0 0 250px;">
    
    <h2>Create Prescription</h2>
    
    NRIC : <label for="NRIC">S9362614H</label><br/>
    Name : <label for="name">Amy</label><br/><br/>
    
	<table class='display' id='medicineTable' name='medicineTable'>
	<thead>
		<tr>
			<th>Medicine Name</th>
			<th>Description</th>
			<th>Indications</th>
		</tr>
	</thead>
	<tbody>
		<%
			for (int i=0; i<medi.size(); i++) {
			m = (Medicine)medi.get(i);
		%>
		<tr>
			<td><%= m.getMedicine() %></td>
			<td><%= m.getMedicine() %></td>
			<td><%= m.getMedicine() %></td>
		</tr>
		<tr>
			<td><%= m.getMedicine() %></td>
			<td><%= m.getMedicine() %></td>
			<td><%= m.getMedicine() %></td>
		</tr>
	<% 
		}
	%>	
	</tbody>

</table>
    
    <input type="button" name="addM" value="Add Medicine"><br/><br/>
    <table border="1" style="border-collapse:collapse">
    <tr>
    	<td>Selected Medicine</td> <td>Dosage(taken)</td> <td>Dosage(times)</td>
    </tr>
    <tr>
    	<td>Pacofen</td> <td>2 Tablets</td> <td>3 times/day</td>
    </tr>
    <tr>
    	<td>Lactose</td> <td>15 ml</td> <td>when necessary</td>
    </tr>
    </table><br/>
    
    <input type ="button" name="back" value="Back" onclick="location.href='createPrescription.jsp'"><input type="submit" value="Create Prescription" style="margin-left:400px">
    
    </div>
    </div>
    <div id="content_bottom"></div>

   </div>
<%@ include file="template/footer.jsp" %>
</body>
</html>